const hre = require("hardhat");

async function main() {
  console.log("Testing XLayerLaunchPad deployment on local network...");
  
  // Deploy contract
  const XLayerLaunchPad = await hre.ethers.getContractFactory("XLayerLaunchPad");
  const mockRouter = "0x02567e4b14b25549331fCEe2B56c647A8bAB16FD";
  
  console.log("Deploying with mock router:", mockRouter);
  const launchPad = await XLayerLaunchPad.deploy(mockRouter);
  await launchPad.deployed();
  
  console.log("XLayerLaunchPad deployed to:", launchPad.address);
  
  // Test basic functionality
  console.log("\n=== Testing Basic Functionality ===");
  
  // Check initial values
  const platformFee = await launchPad.platformFeePercent();
  const nextLaunchId = await launchPad.nextLaunchId();
  const owner = await launchPad.owner();
  
  console.log("Platform Fee:", platformFee.toString(), "basis points");
  console.log("Next Launch ID:", nextLaunchId.toString());
  console.log("Owner:", owner);
  
  console.log("✓ Contract deployed and initialized successfully!");
}

main()
  .then(() => process.exit(0))
  .catch((error) => {
    console.error(error);
    process.exit(1);
  });